<html>
<head>
<script src="prototype.js" type="text/javascript"></script>
<script src="../javascripts/email_recipient_model.js" type="text/javascript"></script>
<script type="text/javascript">
	
	/*	public static final int kFrom = 0;
	public static final int kTo = 1;
	public static final int kCc = 2;
	public static final int kBcc = 3;
	*/
rawInput = [{'id':'14293651161330','role':0,'displayName':'From1'},
{'id':'14293651161331','role':1, 'displayName':'To1'},
{'id':'14293651161331','role':2, 'displayName':'Cc1'},
{'id':'14293651161331','role':3, 'displayName':'Bcc1'},
{'id':'14293651161331','role':0, 'displayName':'From2'},
{'id':'14293651161331','role':1, 'displayName':'To2'},
{'id':'14293651161331','role':2, 'displayName':'Cc2'},
{'id':'14293651161331','role':3, 'displayName':'Bcc2'},
{'id':'14293651161331','role':0, 'displayName':'From3'},
{'id':'14293651161331','role':1, 'displayName':'To3'},
{'id':'14293651161331','role':2, 'displayName':'Cc3'},
{'id':'14293651161331','role':3, 'displayName':'Bcc3'},
];
 

function testRecipListSort() {
	var input = rawInput.collect(function(e) { return Object.extend(e)});
	var list = EmailRecipient.separateRecipients(input);
	//take each array source and write it to the correct div
	$A(list[EmailRecipient.roleTo]).each( function (e) {
		var span = new Element("span");
		span.innerHTML = e.displayName;
		$('to').insert(span);
	});
	
	$A(list[EmailRecipient.roleFrom]).each( function (e) {
		var span = new Element("span");
		span.innerHTML = e.displayName;
		$('from').insert(span);
	});
	
	$A(list[EmailRecipient.roleCc]).each( function (e) {
		var span = new Element("span");
		span.innerHTML = e.displayName;
		$('cc').insert(span);
	});

	$A(list[EmailRecipient.roleBcc]).each( function (e) {
		var span = new Element("span");
		span.innerHTML = e.displayName;
		$('bcc').insert(span);
	});
}
</script>
</head>
<body>
<input type="button" onclick="testRecipListSort()" value="Test Recipient Sort"/>
<div id="to">To:</div>
<div id="from">From:</div>
<div id="cc">Cc:</div>
<div id="bcc">Bcc:</div>
</body>
</html>